package com.njy.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.concurrent.*;

@Component
@Data
@ConfigurationProperties(prefix = "thread")
public class ThreadPoolParam {
    private int corePoolSize = Runtime.getRuntime().availableProcessors() * 8;
    private int maximumPoolSize = Runtime.getRuntime().availableProcessors() * 8;
    private long keepAliveTime = 180;
    private BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>(1024,false);
    private ThreadFactory threadFactory;
    private RejectedExecutionHandler handler = new ThreadPoolExecutor.CallerRunsPolicy();
    private ThreadPoolExecutor threadPool;
    private String ThreadName = "DEFAULT_THREAD";
}
